const routesArr = [
  {
    path: "/Three00-Global",
    name: "three能力概览",
    component: () => import("./Three00-Global.vue"),
  },
  {
    path: "/Three01-Geometry",
    name: "Geometry",
    component: () => import("./Three01-Geometry.vue"),
  },
  {
    path: "/Three02-Shadow",
    name: "阴影",
    component: () => import("./Three02-Shadow.vue"),
  },
  {
    path: "/Three03-model3d",
    name: "3D建模",
    component: () => import("./Three03-model3d.vue"),
  },
  {
    path: "/Three04-Texture",
    name: "纹理(基础)",
    component: () => import("./Three04-Texture.vue"),
  },
  {
    path: "/Three05-Texture-notImage",
    name: "更多纹理",
    component: () => import("./Three05-Texture-notImage.vue"),
  },
  {
    path: "/Three06-bubbles",
    name: "泡泡(未完成)",
    component: () => import("./Three06-bubbles.vue"),
  },
  {
    path: "/Three07-animation",
    name: "动画",
    component: () => import("./Three07-animation.vue"),
  },
  {
    path: "/Three08-examples",
    name: "扩展演练",
    component: () => import("./Three08-examples.vue"),
  },
  {
    path: "/study01-3base",
    name: "相机研究",
    component: () => import("./Study01-Camera.vue"),
  },
  {
    path: "/study02-simpleMesh",
    name: "简单模型",
    component: () => import("./Study02-SimpleMesh.vue"),
  },
];
const defaultRoute = {
  path: "",
  redirect: "/study02-simpleMesh",
};
export default {
  /**
   *
   * @param {import('vue').App} app
   * @param {{routes:[],setDefault:boolean}} param1
   */
  install(app, { routes, setDefault }) {
    if (!Array.isArray(routes)) {
      throw new Error(`You must provide a routes array when install !`);
    }
    if (process.env.NODE_ENV == "development") {
      console.warn(
        "=====[note:] this plugin must install before use router====="
      );
    }
    routes.unshift(...routesArr);

    if (setDefault) {
      routes.unshift(defaultRoute);
    }
  },
};
